package com.alks.function.controller.product;

import com.alks.common.aop.ApiRestController;
import com.alks.common.aop.WebLogger;
import com.alks.entity.data.entity.PcSlipDetailPart;
import com.alks.entity.data.entity.PcSlipTempPart;
import com.alks.entity.data.entity.PcSlipTempPartResp;
import com.alks.entity.data.response.ResponseInfo;
import com.alks.function.data.request.stock.PcOutMaterialReq;
import com.alks.function.data.request.stock.PcSlipTempPartOReq;
import com.alks.function.data.request.stock.PcSlipTempPartReq;
import com.alks.function.data.request.stockdept.pcfactorystockwork.CsmDetRequest;
import com.alks.function.service.product.SdMaterialService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author:hxl
 * @create: 2023-12-16 16:44
 * @Description: 制具消耗品出入库作业
 */
@ApiRestController("/product/sdmaterial")
@Api(tags = {"开发-制具&消耗品出入库作业"})
public class SdMaterialController {
    @Autowired
    private SdMaterialService sdMaterialService;

    @GetMapping("/sdMaterialList")
    @WebLogger
    @ApiOperation(value = "待入库明细",tags = "开发-制具&消耗品出入库作业")
    public ResponseInfo sdMaterialList(){
        return sdMaterialService.sdMaterialList();
    }

    //插入待出库明细
    @GetMapping("/insertMaterialPart")
    @WebLogger
    @ApiOperation(value = "选择材料插入-插入待入库明细",tags = "开发-制具&消耗品出入库作业")
    public ResponseInfo insertMaterialPart(@RequestParam String mtlNo){
        return sdMaterialService.insertMaterialPart(mtlNo);
    }

    //入库批处理
    @PostMapping("/insertBatchPcPart")
    @WebLogger
    @ApiOperation(value = "待入库明细-入库批处理",tags = "开发-制具&消耗品出入库作业")
    public ResponseInfo insertBatchPcPart(@RequestBody PcSlipTempPartReq req){
        return sdMaterialService.insertBatchPcPart(req);
    }

    @PostMapping("/updatePcSlipTempPart")
    @WebLogger
    @ApiOperation(value = "待入库明细-修改",tags = "开发-制具&消耗品出入库作业")
    public ResponseInfo updatePcSlipTempPart(@RequestBody PcSlipTempPartResp req){
        return sdMaterialService.updatePcSlipTempPart(req);
    }

    //入库明细查询
    @PostMapping("/pcSlipDetailPartList")
    @WebLogger
    @ApiOperation(value = "入库明细资料-查询",tags = "开发-制具&消耗品出入库作业")
    public ResponseInfo pcSlipDetailPartList(@RequestBody CsmDetRequest req){
        return sdMaterialService.pcSlipDetailPartList(req);
    }
    //入库明细资料删除
    @PostMapping("/deletePcSlipDetailPart")
    @WebLogger
    @ApiOperation(value = "待入库明细删除",tags = "开发-制具&消耗品出入库作业")
    public ResponseInfo deletePcSlipDetailPart(@RequestParam String mtlNo){
        return sdMaterialService.deletePcSlipDetailPart(mtlNo);
    }

    //选择材料出库查询
    @PostMapping("/outMaterialList")
    @WebLogger
    @ApiOperation(value = "选择材料出库查询",tags = "开发-制具&消耗品出入库作业")
    public ResponseInfo outMaterialList(@RequestParam(required = false) @ApiParam(value = "分类编码") String typeNo,
                                        @RequestParam(required = false) @ApiParam(value = "分类名称") String typeName,
                                        @RequestParam(required = false) @ApiParam(value = "材料名称") String mtlName,
                                        @RequestParam Integer pageNum,
                                        @RequestParam Integer pageSize){
        return sdMaterialService.outMaterialList(typeNo,typeName,mtlName,pageNum,pageSize);
    }

    //选择材料出库到待出库明细
    @PostMapping("/outMaterialInTemp")
    @WebLogger
    @ApiOperation(value = "选择材料出库到待出库明细",tags = "开发-制具&消耗品出入库作业")
    public ResponseInfo outMaterialInTemp(@RequestParam @ApiParam(value = "材料编码") String mtlNo){
        return sdMaterialService.outMaterialInTemp(mtlNo);
    }

    //待出库明细 PcSlipTempPart

    @GetMapping("/pcSlipTempPartOutList")
    @WebLogger
    @ApiOperation(value = "待出库明细",tags = "开发-制具&消耗品出入库作业")
    public ResponseInfo pcSlipTempPartOutList(){
        return sdMaterialService.pcSlipTempPartOutList();
    }

    //出库批处理

    @PostMapping("/outBatchInPcSlipTemp")
    @WebLogger
    @ApiOperation(value = "出库批处理",tags = "开发-制具&消耗品出入库作业")
    public ResponseInfo outBatchInPcSlipTemp(@RequestBody PcSlipTempPartOReq req){
        return sdMaterialService.outBatchInPcSlipTemp(req);
    }

    //修改待出库明细
    @PostMapping("/updatePcSlipTemp")
    @WebLogger
    @ApiOperation(value = "修改待出库明细",tags = "开发-制具&消耗品出入库作业")
    public ResponseInfo updatePcSlipTemp(@RequestBody PcSlipTempPart req){
        return sdMaterialService.updatePcSlipTemp(req);
    }

    //待出库明细删除
    @PostMapping("/deletePcSlipTemp")
    @WebLogger
    @ApiOperation(value = "待出库明细删除",tags = "开发-制具&消耗品出入库作业")
    public ResponseInfo deletePcSlipTemp(@RequestParam String mtlNo){
        return sdMaterialService.deletePcSlipTemp(mtlNo);
    }

    @PostMapping("/pcSlipDetailOutList")
    @WebLogger
    @ApiOperation(value = "其他材料出库明细",tags = "开发-制具&消耗品出入库作业")
    public ResponseInfo pcSlipDetailOutList(@RequestBody PcOutMaterialReq req){
        return sdMaterialService.pcSlipDetailOutList(req);
    }

    //其他材料出库明细
    @PostMapping("/deletePcSlipDetailPartO")
    @WebLogger
    @ApiOperation(value = "其他材料出库明细删除",tags = "开发-制具&消耗品出入库作业")
    public ResponseInfo deletePcSlipDetailPartO(@RequestBody PcSlipDetailPart req){
        return sdMaterialService.deletePcSlipDetailPartO(req);
    }
}
